package app.myproject.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import app.myproject.model.BookmarkVO;

public class BookmarkValidator implements Validator {

	@Override
	public boolean supports(Class clazz) {
		//just validate the Bookmark instances
		return BookmarkVO.class.isAssignableFrom(clazz);
	}

	@Override
	public void validate(Object target, Errors errors) {
		// Check Name
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name",	"required.name", "Name is required.");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "url",	"required.link", "link is required.");

		BookmarkVO bookmark = (BookmarkVO)target;



	}

}
